#!/usr/bin/perl
use warnings;
use strict;
use Readonly;

die "Usage: $0 directory file\n" unless @ARGV > 0;

my ($dir, $file) = @ARGV;
$file ||= "$dir/seeds";
chdir $dir or die "$!";

my $count = 0;
open IN, "< $file" or die "$!";
open OUT1, "> $file.train" or die "$!";
open OUT2, "> $file.precision" or die "$!";
open OUT3, "> $file.recall" or die "$!";
while (<IN>) {
    $count++;
    my $num = $count % 3;
    if ($num == 0) {
        print OUT1 $_;
    }
    elsif ($num == 1) {
        print OUT2 $_;
    }
    else {
        print OUT3 $_;
    }
}
close IN;
close OUT1;
close OUT2;
close OUT3;
print "Done!\n";

